package cn.fx.web.controller;


import cn.fx.result.JsonResult;
import cn.fx.service.IVerifyCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 图形验证码接口
 */
@RequestMapping("/verifycode")
@RestController
public class VerifyCodeController {

    @Autowired
    private IVerifyCodeService verifyCodeService;

    @GetMapping("/imageCode/{imageCodeKey}")
    public JsonResult getVerifyCode(@PathVariable("imageCodeKey") String key) {

        String baseStr = verifyCodeService.getVerifyCode(key);
        //把返回的数据封装到JsonResult,给页面
        return JsonResult.me().setData(baseStr);
    }
}
